<!--{include(pe_tpl('header.html'));}-->
<div class="right">
	<div class="now">
		<a href="javascript:;" class="sel">①基本信息</a>
		<a href="javascript:;">② SEO信息</a>
		<div class="clear"></div>
	</div>
	<form method="post" enctype="multipart/form-data">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat20 menu_table">
	<tr>
		<td align="right">商品名称：</td>
		<td colspan="3"><input type="text" name="info[product_name]" value="{$info['product_name']}" class="inputall input600" maxlength="36" /></td>
		<td rowspan="5" valign="top" style="text-align:left;">
			<img src="{pe_thumb($info['product_logo'])}" width="160" height="160" style="border:1px solid #e4e4e4; display:block;" />
			<p class="mat5"><input type="file" name="product_logo" size="12" style="width:150px;" /></p>
		</td>
	</tr>
	<tr>
		<td align="right">所属分类：</td>
		<td>
			<select name="info[category_id]" class="inputselect" style="width:240px">
			<option value="0">==========请选择分类=========</option>
			<!--{foreach($category_treelist as $v):}-->
			<option value="{$v['category_id']}" <!--{if($v['category_id']==$info['category_id']):}-->selected="selected"<!--{endif;}-->>{$v['category_showname']}</option>
			<!--{endforeach;}-->
			</select>
		</td>
		<td align="right">所属品牌：</td>
		<td>
			<select name="info[brand_id]" class="inputselect" style="width:252px">
			<option value="0">===========请选择品牌==========</option>
			<!--{foreach($cache_brand as $v):}-->
			<option value="{$v['brand_id']}" <!--{if($v['brand_id']==$info['brand_id']):}-->selected="selected"<!--{endif;}-->>[{$v['brand_word']}] {$v['brand_name']}</option>
			<!--{endforeach;}-->
			</select>
		</td>
	</tr>
	<tr>
		<td width="140" align="right">本店价格：</td>
		<td width="240"><input type="text" name="info[product_smoney]" value="{floatval($info['product_smoney'])}" class="inputall input100" /> <span class="c888">元</span></td>
		<td width="100" align="right">市场售价：</td>
		<td width="265"><input type="text" name="info[product_mmoney]" value="{floatval($info['product_mmoney'])}" class="inputall input100" /> <span class="c888">元</span></td>
	</tr>
	<tr>
		<td align="right">运　　费：</td>
		<td><input type="text" name="info[product_wlmoney]" value="{floatval($info['product_wlmoney'])}" class="inputall input100" /> <span class="c888">元</span></td>
		<td align="right">赠送积分：</td>
		<td><input type="text" name="info[product_point]" value="{floatval($info['product_point'])}" class="inputall input100" /> <span class="c888">积分</span></td>
	</tr>
	<tr>
		<td align="right">剩余库存：</td>
		<td><input type="text" name="info[product_num]" value="{$info['product_num']}" class="inputall input100" /> <span class="c888">件</span></td>
		<td align="right">商品货号：</td>
		<td><input type="text" name="info[product_mark]" value="{$info['product_mark']}" class="inputall input100" /></td>
	</tr>
	<!--{if(count($cache_rule)):}-->
	<tr>
		<td align="right" valign="top">商品规格：</td>
		<td colspan="5">
			<a href="javascript:;" class="hy_btn mat2" id="product_rule">选择规格</a>
			<table id="rule_html" class="list mat10" style="width:800px" width="100%">
			<!--{if(count($prorule_list)):}-->
			<tr>
				<th class="table_td bgtt" width="50">序号</th>
				<!--{foreach($rule_list as $v):}-->
				<th class="bgtt">{$cache_rule[$v]['rule_name']}<input type='hidden' name='rule_id[]' value='{$v}' /></th>
				<!--{endforeach;}-->
				<th class="table_td bgtt" width="70">本店价</th>
				<th class="table_td bgtt" width="70">市场价</th>
				<th class="table_td bgtt" width="70">库存</th>
				<th class="table_td bgtt" width="50">操作</th>
			</tr>
			<!--{foreach($prorule_list as $k=>$v):}-->
			<tr>
				<td>{$k+1}</td>
				<!--{$prorule_arr = explode(',', $v['prorule_key'])}-->
				<!--{foreach($prorule_arr as $vv):}-->
				<td>{$cache_ruledata[$vv]['ruledata_name']}</td>
				<!--{endforeach;}-->
				<td class="table_td"><input type="text" name="product_money[]" value="{$v['product_money']}" class="inputtext input40" /></td>
				<td class="table_td"><input type="text" name="product_mmoney[]" value="{$v['product_mmoney']}" class="inputtext input40" /></td>
				<td class="table_td"><input type="text" name="product_num[]" value="{$v['product_num']}" class="inputtext input40" /></td>
				<td class="table_td"><input type="hidden" name="prorule_key[]" value="{$v['prorule_key']}" /><a href="javascript:;" class="hy_btn rule_del">删除</a></td>
			</tr>
			<!--{endforeach;}-->
			<!--{endif;}-->
			</table>
		</td>
	</tr>
	<!--{endif;}-->
	<tr>
		<td align="right">商品详情：</td>
		<td colspan="5" style="padding:5px">
			<textarea name="info[product_text]" id="editortext" style="width:800px;height:450px">{htmlspecialchars($info['product_text'])}</textarea>		
		</td>
	</tr>
	</table>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang mat20 menu_table" style="display:none">
	<tr>
		<td align="right" width="140">页面关键词：</td>
		<td><input type="text" name="info[product_keys]" value="{$info['product_keys']}" class="inputall input500" /> <span class="c888">（SEO选项）</span></td>
	</tr>
	<tr>
		<td align="right">页面描述：</td>
		<td><textarea name="info[product_desc]" style="width:500px;height:100px;">{$info['product_desc']}</textarea> <span class="c888">（SEO选项）</span></td>
	</tr>
	</table>
	<div class="mat10 mab10">
		<input type="hidden" name="pesubmit" />
		<input type="hidden" name="pe_token" value="{$pe_token}" />
		<input type="button" value="提 交" class="tjbtn" style="margin-left:525px" />
	</div>
	</form>
</div>
<style type="text/css">
#rule_html th{padding:3px 5px; border:1px #e5e5e5 solid; border-right:0; border-left:0; font-weight:normal;}
#rule_html td{padding:5px}
</style>
<script type="text/javascript" src="{$pe['host_root']}include/plugin/my97/WdatePicker.js"></script>
<script charset="utf-8" src="{$pe['host_root']}include/plugin/editor/kindeditor.js"></script>
<script charset="utf-8" src="{$pe['host_root']}include/plugin/editor/lang/zh_CN.js"></script>
<script charset="utf-8" src="{$pe['host_root']}include/plugin/artdialog/jquery.artDialog.js?skin=chrome"></script>
<script charset="utf-8" src="{$pe['host_root']}include/plugin/artdialog/plugins/iframeTools.js"></script>
<script type="text/javascript" charset="utf-8">
var editor;
KindEditor.ready(function(K) {
	editor = K.create('#editortext', {
		allowFlashUpload :false,
		afterBlur: function(){
			this.sync();
		}
	});
});
$(function(){
	$(":button").click(function(){
		var kong_num = rule_num = 0;
		if ($(":input[name='prorule_key[]']").length > 0) {
			$("#rule_html").find(":input").each(function(){
				if ($(this).attr("disabled") == "disabled" || $(this).is(":hidden")) return true;
				if ($(this).val() == '') kong_num++;
			})
			if (kong_num > 0) {
				alert('规格属性尚未填写完全');
				return;
			}
		}
		$("form").submit();
	})
	$(".now a").click(function(){
		var _index = $(this).index();
		$(".now a").removeClass("sel");	
		$(this).addClass("sel");
		$(".menu_table").hide().eq(_index).show();
	})
	$("#product_rule").click(function(){
		url = "admin.php?mod=product&act=rule";
		if ($(":input[name='prorule_key[]']").length > 0) {
			var prorule_key = new Array();
			$(":input[name='prorule_key[]']").each(function(){
				prorule_key.push($(this).val());
			})
			prorule_key = prorule_key.join(',');
			url += "&prorule_key="+ prorule_key;
		}
		art.dialog.open(url, {title:'选择规格', width: 720, height: 400, id: 'product_rule'});
	})	
	$(".rule_del").live("click", function(){
		if ($("#rule_html tr").length <= 2) {
			$("#rule_html tr").remove();
		}
		else {
			$(this).parent().parent("tr").remove();
		}
	})
})
function move_left(obj) {
    var current = $(obj).parent();
    var prev = current.prevAll(":visible").first();
	var current_other = $(":input[name='"+current.attr("id")+"[]']").parent();
   	var prev_other;
	if (current.index()>0) {
		current.insertBefore(prev);
		current_other.each(function(){
			prev_other = $(this).prevAll(":visible").first();
			$(this).insertBefore(prev_other);
		})
	}
}  
function move_right(obj) {
    var current = $(obj).parent();
    var next = current.nextAll(":visible").first();
	var current_other = $(":input[name='"+current.attr("id")+"[]']").parent();
    var prev_other;
	var num = $(obj).parent().parent().find("td").length;
    if (current.index()<num-4) {
		current.insertAfter(next);
		current_other.each(function(){
			prev_other = $(this).nextAll(":visible").first();
			$(this).insertAfter(prev_other);
		})
	}
}
</script>
<!--{include(pe_tpl('footer.html'));}-->